package com.atguigu.seckill.config;

import org.redisson.Redisson;
import org.redisson.api.RedissonClient;
import org.redisson.config.Config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.io.IOException;

/**
 * @Description:
 * @Created: with IntelliJ IDEA.
 * @author: 夏沫止水
 * @createTime: 2020-06-11 09:39
 **/

@Configuration
public class MyRedissonConfig {
    //整合redisson配置
    @Bean(destroyMethod = "shutdown")
    public RedissonClient redisson() throws IOException {
        Config config = new Config();
        //创建配置单节点redis
        config.useSingleServer().setAddress("redis://192.168.164.128:6379");
        //2. 根据config创建出redissonClient实例
        return Redisson.create(config);
    }

}